<template>
	<view class="mainpadding beijingse">
		<view class="mainpadding ffffff">
			<view class="xiahuaxian" v-for="item in list.data" :key="item.id">
				<view class="flexbetween">
					<view class="ershiba xiaohei">卡号：{{item.account}}</view>
					<view class="sanshier fonweight xiaocheng">{{item.money}}</view>
				</view>
				<view class="flexbetween margin_top">
					<view class="ershiba xiaohei">密码：{{item.password}}</view>
					<view class="strongtext xiaohui">{{item.createtime_text}}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
page: 1,
				limit: 12,
				list: {
					data: []
				},
			}
		},
		onShow() {
			this.init()
		},
		methods: {
init(isPage, page) {
				let _this = this
				let url = "/api/user/moneyLog"
				let data = {
					page: page || 1,
					limit: _this.limit,
					data_type:2
				}
				httpRequest.request(url, 'GET', data, false, false, true).then(res => {
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
		}
	}
</script>

<style lang="scss" scoped>
	.xiahuaxian:last-child {
		padding-bottom: 0;
		border: none;
	}
</style>